<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>支付结果页</title>
    <style>
        .container {
            margin: 0 auto;
            text-align: center;
        }
        .button{
            min-width: 140px;
            line-height: 38px;
            text-align: center;
            font-weight: bold;
            color: #fff;
            text-shadow:1px 1px 1px #333;
            border-radius: 5px;
            position: relative;
            overflow: hidden;
        }
        .button-first {
            margin-top: 30vh;
        }
        .button.green{
            border:1px solid #64c878;
            box-shadow: 0 1px 2px #b9ecc4 inset,0 -1px 0 #6c9f76 inset,0 -2px 3px #b9ecc4 inset;
            background: -webkit-linear-gradient(top,#90dfa2,#84d494);
            background: -moz-linear-gradient(top,#90dfa2,#84d494);
            background: linear-gradient(top,#90dfa2,#84d494);
        }
        .button.yellow{
            border:1px solid #f8822b;
            box-shadow: 0 1px 2px #ff6d00 inset,0 -1px 0 #e1a371 inset,0 -2px 3px #ff6d00 inset;
            background: -webkit-linear-gradient(top, #ff6d00, #ff6d00);
            background: -moz-linear-gradient(top, #ff6d00, #ff6d00);
            background: linear-gradient(top, #ff6d00, #ff6d00);
        }
    </style>
</head>
<body>
<div class="container">
    <h5>订单编号: {{ $payOrder->orderid }}</h5>
    <h3>{{ now() }}</h3>
@if($payOrder->status === \App\Models\Game\Center\PayOrder::STATUS_PAYED)
    <h3>恭喜您支付成功, 请手动返回游戏</h3>
{{--    <button type="button" class="button button-first green" onclick="openApp()">返回游戏</button>--}}
@else
    <h3>未查到支付结果, 如果已扣款, 请联系客服</h3>
    <button type="button" class="button button-first yellow" onclick="window.location.reload()">刷新支付结果</button>
{{--    <button type="button" class="button button-first green" onclick="openApp()">返回游戏</button>--}}
@endif
</div>
<script>
    var timer = null;
    function addEvent() {
        window.addEventListener('visibilitychange', function() {
            // 监听页面visibility
            if(document.hidden) {
                // 如果页面隐藏了，则表示唤起成功，清除下载定时器
                clearTimeout(timer)
            }
        });
    }
    function openApp() {
        if (timer != null) return;
        addEvent();
        timer = window.setTimeout(function() {
            alert('返回游戏失败了, 指挥官手动返回吧');
        }, 3000);
        window.location.href = '{{config('game.apk.scheme')}}';
    }

    // openApp();
</script>
</body>
</html>
